package com.milk.nettylearn.nio;

import java.nio.ByteBuffer;

import static com.milk.nettylearn.nio.ByteBufferUtil.debugAll;

public class TestByteBufferRead {
    public static void main(String[] args) {
        ByteBuffer buffer = ByteBuffer.allocate(10);
        buffer.get(1);
        buffer.put(new byte[]{'a', 'b', 'c', 'd'});
        debugAll(buffer);
        buffer.flip();
        System.out.println("读取结果:"+buffer.get());
        System.out.println("读取结果:"+buffer.get());
        buffer.mark();
        debugAll(buffer);

        System.out.println("读取结果:"+buffer.get());
        System.out.println("读取结果:"+buffer.get());
        buffer.reset();

        System.out.println("读取结果:"+buffer.get());
        System.out.println("读取结果:"+buffer.get());


    }
}
